package cn.et;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SendController {
	
	//调用feign定义的接口
	@Autowired
	ISendMail isd;
	
	
	@GetMapping("/sendclient")
	public String send(String emailto,String emailsubject,String emailcenter){
		//调用sendmain服务
		String  controller ="/sends";
		//通过注册中心客户端负载均衡 获取一台主机来调用
		try{
			
			Map map=new HashMap();    
			map.put("emailto", emailto);  
			map.put("emailsubject", emailsubject);  
			map.put("emailcenter", emailcenter);  
			isd.sends(map);
			
			return "redirect:/suc.html";
		}catch(Exception e){
			e.printStackTrace();
			return "/error.html";
		}
		
	
	}

	
}
